#pragma once #include char *randstring(size_t length) { static char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; char *randomString = NULL; time_t t; if (length) { randomString = malloc(sizeof(char) * (length +1)); srand((unsigned) time(&t)); if (randomString) { for (int n = 0;n < length;n++) { int key = rand() % (int)(sizeof(charset) -1); randomString[n] = charset[key]; } randomString[length] = '\0'; } } return randomString; }